package com.wind.cloud.common.util;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;

import java.util.UUID;

/**
 * id utils（全局唯一）
 *
 * @author wind.
 */
public abstract class IdUtils {

    public static String getId() {
        return getId(IdWorker.getId());
    }

    private static String getId(long time) {
        StringBuilder sb = new StringBuilder(48);
        sb.append(Long.toHexString(time));
        sb.append(UUID.randomUUID().toString().replaceAll("-", ""));
        return sb.substring(0, 32);
    }

    public static void main(String[] args) {
        System.out.println(getId());
    }

}
